package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.SystemElement;
import com.micro.modual.model.bo.systemelement.SystemElementBO;

import java.util.Date;

/**
 * <h1>系统元素表 延展类</h1>
 *
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:26
 */
public class SystemElementExtension {

    /**
     * <h2>转换: 系统元素表 新增</h2>
     *
     * @param systemElementBO {@link SystemElementBO} 系统元素表 新增/修改 请求对象
     * @return {@link SystemElement} 系统元素表
     */
    public static SystemElement converAddSystemElement(SystemElementBO systemElementBO) {
        SystemElement systemElement = new SystemElement();
        systemElement.setId(SnowFlakeUtil.getId());
        systemElement.setAuthCode(systemElementBO.getAuthCode());
        systemElement.setCreateTime(new Date());
        systemElement.setElementCode(GeneratorCodeUtil.generatorSystemCode());
        systemElement.setElementDesc(systemElementBO.getElementDesc());
        systemElement.setElementMethod(systemElementBO.getElementMethod());
        systemElement.setElementName(systemElementBO.getElementName());
        systemElement.setElementType(systemElementBO.getElementType());
        systemElement.setElementUri(systemElementBO.getElementUri());
        systemElement.setMenuCode(systemElementBO.getMenuCode());
        return systemElement;
    }

    /**
     * <h2>转换: 系统元素表 修改</h2>
     *
     * @param systemElementBO {@link SystemElementBO} 系统元素表 新增/修改 请求对象
     * @return {@link SystemElement} 系统元素表
     */
    public static SystemElement converEditSystemElement(SystemElementBO systemElementBO) {
        SystemElement systemElement = new SystemElement();
        systemElement.setId(systemElementBO.getId());
        systemElement.setAuthCode(systemElementBO.getAuthCode());
        systemElement.setElementCode(GeneratorCodeUtil.generatorSystemCode());
        systemElement.setElementDesc(systemElementBO.getElementDesc());
        systemElement.setElementMethod(systemElementBO.getElementMethod());
        systemElement.setElementName(systemElementBO.getElementName());
        systemElement.setElementType(systemElementBO.getElementType());
        systemElement.setElementUri(systemElementBO.getElementUri());
        systemElement.setMenuCode(systemElementBO.getMenuCode());
        systemElement.setUpdateTime(new Date());
        return systemElement;
    }
}
